<template>
	<view class="bg-white flex align-center justify-center" style="height: 100%;width: 100%;">
		<view style="margin-top: -300rpx;">
			<view class="text-center">
				<image src="/static/logo.jpg"
				class="solids padding-xs"
				style="width: 200rpx;height: 200rpx;"></image>
				<view class=" text-bold text-lg">儿童摄影项目</view>
			</view>
			<view class="margin-top padding" style="">
				<button class="cu-btn bg-cyan" style="width: 100%;"  @click="loginClick">微信一键授权</button>
			</view>
			<view class="flex align-center margin-top justify-center"
			style="font-size: 25rpx;">
				<view class="round text-xxl flex align-center justify-center" 
				style="height: 30rpx;width: 30rpx;"
				:class="curData.isTongyi?'cuIcon-check bg-cyan':'bg-grey'"
				@click="curData.isTongyi = !curData.isTongyi">
				</view>
				<view class="margin-left-xs" style="color: #999999;">
					<text @click="curData.isTongyi = !curData.isTongyi">我已阅读并同意</text>
					<text class="text-blue" @click="xieyiClick">《用户协议》</text>
					和
					<text class="text-blue" @click="yinsiClick">《隐私协议》</text>
					</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				curData:{
					isTongyi:true
				},
			}
		},
		onLoad() {
		},
		methods: {
			loginClick(){
				//是否同意协议
				if(this.curData.isTongyi === false){
					uni.$common.modalWarin("请先同意用户协议")
					return
				}
				// 使用微信登录
				uni.$login.login(()=>{
					uni.$common.toastSuccess("授权成功",()=>{
						this.toCode(); //编码输入页面
					})
				})
			},
			// 跳转幼儿园编码输入页面
			toCode(){
				uni.navigateTo({
					url:"/pages/input/input"
				})
			},
			xieyiClick(){
				uni.$api.configXieyi().then(data=>{
					uni.$common.navigateTo("/subpkg/commons/web-show/web-show",{
						type:"HTML",
						title:data.name,
						content:encodeURIComponent(JSON.parse(data.value).content)
					})
				})
			},
			yinsiClick(){
				uni.$api.configYinsi().then(data=>{
					uni.$common.navigateTo("/subpkg/commons/web-show/web-show",{
						type:"HTML",
						title:data.name,
						content:encodeURIComponent(JSON.parse(data.value).content)
					})
				})
			}
		},
	}
</script>

<style scoped lang="scss">
</style>
